import request from "@/utils/request";

export const categoryApi = {
  // 获取分类列表
  getCategories() {
    return request({
      url: "/api/categories",
      method: "get",
    });
  },

  // 创建分类
  createCategory(data) {
    return request({
      url: "/api/categories",
      method: "post",
      data,
    });
  },

  // 更新分类
  updateCategory(id, data) {
    return request({
      url: `/api/categories/${id}`,
      method: "put",
      data,
    });
  },

  // 删除分类
  deleteCategory(id) {
    return request({
      url: `/api/categories/${id}`,
      method: "delete",
    });
  },
};
